home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 January / Chip_1999-01_cd.bin / sharewar / cppc / CPPC.EXE / Programmers only / ext_h / CP_EXT.h
Encoding:
C/C++ Source or Header  |  1997-10-18  |  3.4 KB  |  147 lines

  1. /*
  2.     file: CP_EXT.h
  3.  
  4.     header file for copypaste externals
  5.  
  6.     History:
  7.     Version 1.0        10/9/1997
  8. */
  9.  
  10.  
  11. #ifndef _CP_EXTERNALS_
  12. #define _CP_EXTERNALS_ 1
  13.  
  14.  
  15. #include <windows.h>
  16.  
  17.  
  18. //
  19. //    this section describe how to call back to CopyPaste
  20. //    from your external.
  21. //
  22.  
  23. //    Parameter block to pass to the CopyPaste entry point.
  24. //    the contents of this struct depends on the
  25. //    CPEntrypointOptions described below
  26.  
  27. typedef struct CPParamBlock
  28. {
  29.     SHORT    wparam1;
  30.     SHORT    wparam2;
  31.     LONG    lparam1;
  32.     LONG    lparam2;
  33.     HANDLE    handle1;
  34.     HANDLE    handle2;
  35. }
  36. CPParamBlock, *pCPParamBlock;
  37.  
  38.  
  39. //    here comes the valid options to call back to CopyPaste
  40. //    <- indicate that these values must be initialized on entry
  41. //    -> filled with result on exit
  42.  
  43. enum CPEntrypointOptions
  44. {
  45.     /*    wparam1        ->    number of clipboard ( 0..9 )
  46.     */
  47.     eGetCurrentClipboard    = 1,
  48.  
  49.     /*    wparam1        ->    number of entrys in handle1 ( const 10 )
  50.         handle1        ->    list of UINTs containing number of formats
  51.                         for each clipboard || 0 for empty clipboard
  52.                         allocated with GlobalAlloc(
  53.                                 GMEM_MOVEABLE|GMEM_DDE_SHARE).
  54.                         caller is responsible to GlobalFree()
  55.     */
  56.     eGetClipboardList,
  57.  
  58.     /*    wparam1        <-    number of clipboard ( 0..9 )
  59.         wparam2        ->    number of formats || 0
  60.         handle1        ->    list of UINTs containing formats
  61.                         allocated with GlobalAlloc(
  62.                                 GMEM_MOVEABLE|GMEM_DDE_SHARE).
  63.                         caller is responsible to GlobalFree()
  64.                         NULL if formats == 0
  65.     */
  66.     eGetClipboardFormatList,
  67.  
  68.     /*    wparam1        <-    number of clipboard ( 0..9 )
  69.         wparam2        <-    clipboard format CF_TEXT, CF_DIB...
  70.         handle1        ->    copy of clipboard data handle || NULL
  71.                         allocated with GlobalAlloc(
  72.                                 GMEM_MOVEABLE|GMEM_DDE_SHARE).
  73.                         caller is responsible to GlobalFree()
  74.     */
  75.     eGetClipboardItem,
  76.  
  77.     /*    wparam1        <-    number of clipboard ( 0..9 )
  78.         wparam2        <-    clipboard format CF_TEXT, CF_DIB...
  79.         handle1        <-    handle of data, returned from GetClipboardItem
  80.                         || allocated with GlobalAlloc(
  81.                                 GMEM_MOVEABLE|GMEM_DDE_SHARE).
  82.     */
  83.     eSetClipboardItem        = 10
  84.  
  85. };
  86.  
  87.  
  88. //    next are possible errors returned from Callback to CopyPaste
  89. //    if errors is not listed here, its a value from GetLastError()
  90.  
  91. enum CPErrors
  92. {
  93.     errNoError,
  94.     errClipboardIsEmpty        = -1000,
  95.     errFormatNotAvailable    = -1001,
  96.     errNoCurrentClipboard    = -1002,
  97.     errEmptyDataHandle        = -1003
  98. };
  99.  
  100.  
  101. //    here is how to call to CopyPaste
  102.  
  103. typedef LRESULT (CALLBACK *CPEntryProcPtr)(CPEntrypointOptions option, 
  104.                                            CPParamBlock *param );
  105.  
  106.  
  107. //    this macro makes it easy to call back to CopyPaste
  108. //    entryPoint is the second argument from "ENTRYPOINT"
  109.  
  110. #define CallCP(x,y)        (*entryPoint)(x,y)
  111.  
  112.  
  113.  
  114. //    this are the options passed to ENTRYPOINT as first argument
  115. enum CPExternalOptions
  116. {
  117.     eInitExternal    = -2,    //    called once at startup
  118.     eDeinitExternal = -1,    //    called once on exit
  119.     eFirstOption    = 1        //    your first custom menu call
  120.  
  121.     /* define options as you like */
  122. };
  123.  
  124.  
  125. //
  126. //    this section describe how CopyPaste calls your externals
  127. //
  128.  
  129. //    this define names the entrypoint used by GetProcAddress()
  130. #define kENTRYPOINTNAME        "CP_ENTRYPOINT"
  131.  
  132.  
  133. //    CopyPaste entry point to the externals
  134.  
  135. typedef LRESULT (CALLBACK *ENTRYPOINTFP)(SHORT option, 
  136.             CPEntryProcPtr entryPoint, LPARAM *lparam, HANDLE *globals);
  137.  
  138.  
  139. //    prototype for our external main entry point
  140.  
  141. LRESULT CALLBACK CP_ENTRYPOINT(SHORT option, CPEntryProcPtr entryPoint,
  142.                                 LPARAM *lparam, HANDLE *globals);
  143.  
  144.  
  145.  
  146. #endif    // _CP_EXTERNALS_
  147.